// 导入request.js异步请求工具 
import request from '@/utils/request.js'
//导入store
import {useTokenStore} from '@/stores/token.js'
//文章分类列表查询
export const articleCategoryListService=()=>{
    const tokenStore = useTokenStore();     
    //在pinia中定义的响应式数据,都不需要.value
    // return request.get( '/category',{headers:{'Authorization':tokenStore.token}})
    return request.get( '/category')
}

//文章分类添加
export const articleCategoryAddService = (categoryData) => {
    //这里传的是json数据
    return request.post('/category',categoryData)
}

//文章分类修该
export const articleCategoryUpdateService = (categoryData) => {
    //这里传的是json数据
    return request.put('/category',categoryData)
}

//文章分类删除
export const articleCategoryDeleteService = (id) => {
    return request.delete('category?id='+id)
}
 

//文章列表查询
export const articleListService = (params) => {
    return request.get('/article/list',{params:params})
}

//文章添加
export const articleAddService = (articleData) => {
    //这里传的是json数据
   return request.post('/article',articleData)
}


//文章修改
export const articleUpdateService = (articleData) => {
    return request.put('/article',articleData)
}


//文章删除
export const articleDeleteService = (id) => {
    return request.delete('/article?id='+id)
}




